<?php
include "libs/WxPay.Api.php";
require_once "WxPay.MicroPay.php";

$data = json_decode(file_get_contents('php://input'), true);
if(is_array($data) && !empty($data)){
    $input = new WxPayMicroPay();
    $input->SetAuth_code($data['authCode']);
    $input->SetBody($data['subject']);
    $input->SetTotal_fee(round($data['totalAmount'] * 100));
    $input->SetOut_trade_no($data['outTradeNo']);
    $microPay = new MicroPay();

    echo json_encode($microPay->pay($input));
}